import time


def decorator(func):
    def inner():
        # 获取当前时间
        time1=time.time()
        func()
        time2=time.time()
        print(time2-time1)
    return inner

@decorator
def work():
    for i in range(10000):
        print(i)

work()